package com.google.code.jskills.dal.entities;

// Generated 25.06.2013 17:52:09 by Hibernate Tools 3.6.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * RoleEntity generated by hbm2java
 */
@Entity
@Table(name = "ROLE_", schema = "PUBLIC", catalog = "PUBLIC", uniqueConstraints = @UniqueConstraint(columnNames = "NAME"))
public class RoleEntity implements java.io.Serializable {

	private Integer id;
	private String name;
	private String description;
	private Set<RolePermissionEntity> rolePermissionEntities = new HashSet<RolePermissionEntity>(
			0);
	private Set<UserRoleEntity> userRoleEntities = new HashSet<UserRoleEntity>(
			0);
	private Set<GroupRoleEntity> groupRoleEntities = new HashSet<GroupRoleEntity>(
			0);

	public RoleEntity() {
	}

	public RoleEntity(String name) {
		this.name = name;
	}

	public RoleEntity(String name, String description,
			Set<RolePermissionEntity> rolePermissionEntities,
			Set<UserRoleEntity> userRoleEntities,
			Set<GroupRoleEntity> groupRoleEntities) {
		this.name = name;
		this.description = description;
		this.rolePermissionEntities = rolePermissionEntities;
		this.userRoleEntities = userRoleEntities;
		this.groupRoleEntities = groupRoleEntities;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "NAME", unique = true, nullable = false, length = 64)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "DESCRIPTION", length = 512)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "roleEntity")
	public Set<RolePermissionEntity> getRolePermissionEntities() {
		return this.rolePermissionEntities;
	}

	public void setRolePermissionEntities(
			Set<RolePermissionEntity> rolePermissionEntities) {
		this.rolePermissionEntities = rolePermissionEntities;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "roleEntity")
	public Set<UserRoleEntity> getUserRoleEntities() {
		return this.userRoleEntities;
	}

	public void setUserRoleEntities(Set<UserRoleEntity> userRoleEntities) {
		this.userRoleEntities = userRoleEntities;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "roleEntity")
	public Set<GroupRoleEntity> getGroupRoleEntities() {
		return this.groupRoleEntities;
	}

	public void setGroupRoleEntities(Set<GroupRoleEntity> groupRoleEntities) {
		this.groupRoleEntities = groupRoleEntities;
	}

}
